<?php
/**
 * @link      http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license   http://www.yiiframework.com/license/
 */

namespace app\assets;


use app\common\services\UrlServices;
use app\common\services\UtilService;
use yii\web\AssetBundle;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since  2.0
 */
class WeixinAsset extends AssetBundle {
    public $basePath = '@webroot';
    public $baseUrl = '@web';

    public function registerAssetFiles($view)
    {
        $version = defined('VERSION') ? VERSION : time();
        $this->css = [
//            UrlServices::buildWWWUrl('css/weixin/common.css',['ver'=>$version]),
//            UrlServices::buildWWWUrl('css/weixin/index.css',['ver'=>$version])

        ];
        if (UtilService::isWechat()) {
            $this->js = [
                'http://res.wx.qq.com/open/js/jweixin-1.2.0.js',
                'plugins/jquery-2.1.1.js',
                'yaojiang/js/common.js?ver=' . $version,
                'yaojiang/js/preload.jquery.js',
            ];
        } else {
            $this->js = [
                'plugins/jquery-2.1.1.js',
                'js/web/common.js?ver=' . $version,
            ];
        }

        parent::registerAssetFiles($view); // TODO: Change the autogenerated stub
    }
}


